######################################################
#
# boot parmaters set:
#   -e DISPLAY=:0
#   -e DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
#   -v /run/user/1000/bus:/run/user/1000/bus
#   -v /tmp/.X11-unix/X0:/tmp/.X11-unix/X0
# 
######################################################

# base image
FROM opensuse:tumbleweed
# FROM suse-xfce:tumbleweed

MAINTAINER ystlong@163.com

# 替换仓库地址，貌似已经不需要替换了，直接用mirrors地址获取到的就很快
# RUN find /etc/zypp/repos.d -type f -exec sed -i 's|download.opensuse.org/tumbleweed|mirrors.ustc.edu.cn/opensuse/tumbleweed|g' {} \;
RUN zypper in -y glibc-locale glibc-i18ndata
RUN zypper in -y google*fonts wqy*fonts xorg-x11-fonts
RUN zypper in -y lxterminal xterm vi
RUN zypper in -y p7zip unzip unrar tar
RUN zypper in -y wget curl which command-not-found
RUN zypper in -y iproute2 net-tools-deprecated

# 某些程序需要这个ID， 貌似是dbus，32bytes字符
RUN echo 12345678123456781234567812345678 > /etc/machine-id

# 添加用户
RUN useradd --create-home --no-log-init --shell /bin/bash long
RUN echo 'root:123456' |chpasswd
RUN echo 'export LANG=en_US.UTF-8' > /home/long/.bashrc
RUN echo "alias ls='ls --color'" >> /home/long/.bashrc

# 输入法配置
# ADD http://ys-c.ys168.com/244626543/hjf5xVk4K465F3K6KM6/yong-lin-2.5.0-0.7z /tmp/yong-lin-2.5.0-0.7z
# RUN mkdir -p /opt && cd /opt && 7zr x /tmp/yong-lin-2.5.0-0.7z
# RUN /opt/yong/yong-tool.sh --install64
# 当host与容器LANG配置一致时可以使用fcitx
RUN zypper in -y fcitx
RUN echo 'export XMODIFIERS="@im=fcitx"' >> /home/long/.bashrc
RUN echo 'export QT_IM_MODULE=fcitx' >> /home/long/.bashrc
RUN echo 'export INPUT_METHOD=fcitx' >> /home/long/.bashrc
RUN echo 'export GTK_IM_MODULE=fcitx' >> /home/long/.bashrc

USER long
WORKDIR /home/long
